﻿using models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcApplication3.Services
{
    public class Credit
    {
        public User UpdateUserCredit(User user, decimal realAmount, decimal virtualAmount)
        {
            user.Credit.Transactions.Add(new Transaction() { Date = DateTime.Now, RealAmount = realAmount, VirtualAmount = virtualAmount, Credit = user.Credit });
            user.Credit.RealAmount = user.Credit.RealAmount + realAmount;
            user.Credit.VirtualAmount = user.Credit.VirtualAmount + virtualAmount;
            return user;
        }
    }
}